@extends('_layout.master')

@section('right')
    <div class="col-md-9">
        <div class="row border1">
            <div class="col-md-5">
                <span class="list-icon pull-left"></span>
                <h4 style="color: #ff6637;" class="pull-left">推荐产品</h4>
            </div>
            <div class="col-md-2 col-md-offset-5 text-right">
                <a href="{{ route('productList', ['id' => '0']) }}" class="more">更多>></a>
            </div>
        </div>
        <div class="row">
            <div id="mar" style="width: 740px;">
                @foreach($recommendProducts as $recommendProduct)
                    <a href="{{ route('productContent', ['id' => $recommendProduct->id]) }}">
                        <img src="{{ asset('upload/'.$recommendProduct->pictures[0]) }}" style="width: 200px;height: 150px;">
                    </a>
                @endforeach
            </div>
        </div>
        <div class="row border1" style="margin-top: 20px;">
            <div class="col-md-5">
                <span class="list-icon pull-left"></span>
                <h4 style="color: #ff6637;" class="pull-left">公司简介</h4>
            </div>
            <div class="col-md-2 col-md-offset-5 text-right">
                <a href="{{ route('articleTypeContentImg', ['id' => 2]) }}" class="more">更多>></a>
            </div>
        </div>
        <div class="row">
            <p style="color: #666666;">
                {{ mb_substr(strip_tags($companyIntroduce->content), 0, 200) }}……
            </p>
        </div>
        <div class="row border1" style="margin-top: 10px;">
            <div class="col-md-5">
                <span class="list-icon pull-left"></span>
                <h4 style="color: #ff6637;" class="pull-left">新闻动态</h4>
            </div>
            <div class="col-md-2 col-md-offset-5 text-right">
                <a href="{{ route('articleList', ['id' => 1]) }}" class="more">更多>></a>
            </div>
        </div>
        <div class="row news">
            <div class="col-md-8 col-md-offset-4">
                <ul class="list-unstyled list1">
                    @foreach($news as $new)
                        <li>
                            <div class="row">
                                <div class="col-md-9">
                                    <a
                                        href="{{ route('articleContent', ['id' => $new->id]) }}" class="news-title">
                                        {{ mb_substr($new->title, 0, 22) }}
                                    </a>
                                </div>
                                <div class="col-md-3 text-right news-date">{{ $new->created_at->format('Y-m-d') }}</div>
                            </div>
                        </li>
                    @endforeach
                </ul>
            </div>
        </div>
    </div>
@endsection

@section('script')
    <script src="{{ asset('js/jquery.liMarquee.js') }}"></script>
    <script>
        $(function () {
            $('#mar').liMarquee();

            $('.news-title').mouseover(function () {
                $(this).css('color', '#ff6637');
                $(this).parent().next('div').css('color', '#ff6637');
            });
            $('.news-title').mouseout(function () {
                $(this).css('color', '#666666');
                $(this).parent().next('div').css('color', '#666666');
            });

            $('#login').click(function () {
                $('#alert-msg .modal-body').html('<h5>用户名密码错误！</h5>');
                $('#alert-msg').modal();
            });
        });
    </script>
@endsection